package com.server.pinggu.service.impl;

import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.server.pinggu.mapper.SenGuestbookMapper;
import com.server.pinggu.domain.SenGuestbook;
import com.server.pinggu.service.ISenGuestbookService;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author ltao
 * @date 2022-10-23
 */
@Service
public class SenGuestbookServiceImpl extends ServiceImpl<SenGuestbookMapper, SenGuestbook> implements ISenGuestbookService {

    @Override
    public List<SenGuestbook> queryList(SenGuestbook senGuestbook) {
        LambdaQueryWrapper<SenGuestbook> lqw = Wrappers.lambdaQuery();
        if (senGuestbook.getPid() != null){
            lqw.eq(SenGuestbook::getPid ,senGuestbook.getPid());
        }
        if (StringUtils.isNotBlank(senGuestbook.getName())){
            lqw.like(SenGuestbook::getName ,senGuestbook.getName());
        }
        if (StringUtils.isNotBlank(senGuestbook.getEmail())){
            lqw.eq(SenGuestbook::getEmail ,senGuestbook.getEmail());
        }
        if (StringUtils.isNotBlank(senGuestbook.getHomepage())){
            lqw.eq(SenGuestbook::getHomepage ,senGuestbook.getHomepage());
        }
        if (StringUtils.isNotBlank(senGuestbook.getMemberid())){
            lqw.eq(SenGuestbook::getMemberid ,senGuestbook.getMemberid());
        }
        if (StringUtils.isNotBlank(senGuestbook.getIp())){
            lqw.eq(SenGuestbook::getIp ,senGuestbook.getIp());
        }
        if (senGuestbook.getIspublic() != null){
            lqw.eq(SenGuestbook::getIspublic ,senGuestbook.getIspublic());
        }
        if (senGuestbook.getDttime() != null){
            lqw.eq(SenGuestbook::getDttime ,senGuestbook.getDttime());
        }
        if (StringUtils.isNotBlank(senGuestbook.getContent())){
            lqw.eq(SenGuestbook::getContent ,senGuestbook.getContent());
        }
        if (StringUtils.isNotBlank(senGuestbook.getTitle())){
            lqw.eq(SenGuestbook::getTitle ,senGuestbook.getTitle());
        }
        if (StringUtils.isNotBlank(senGuestbook.getTelephone())){
            lqw.eq(SenGuestbook::getTelephone ,senGuestbook.getTelephone());
        }
        if (StringUtils.isNotBlank(senGuestbook.getCompany())){
            lqw.eq(SenGuestbook::getCompany ,senGuestbook.getCompany());
        }
        if (senGuestbook.getAuditing() != null){
            lqw.eq(SenGuestbook::getAuditing ,senGuestbook.getAuditing());
        }
        return this.list(lqw);
    }
}